In the field of distributed transaction processing, the XA specification promulgated by The Open Group can be used to describe a protocol and interface between a transaction manager and one or more local resource managers. This enables a plurality of resources, such as application servers and databases, to be accessed within the same transaction, thus preserving the ACID (atomicity, consistency, isolation, durability) properties of the transaction.
The XA protocol supports a variety of optimizations that can be optionally employed depending on the needs of a particular implementation. For example, an IsSameRM optimization can be used in instances where multiple connections that are being used in the same transaction, and that point to the same resource manager (e.g., the same database), can be joined in order to avoid the need for certain XA protocol network calls. Since such XA calls constitute a performance detriment, and may also necessitate additional assets, joining connections can sometimes provide performance benefits.
However, a shortcoming with some optimizations, such as the IsSameRM optimization, is that the optimization can itself be a performance detriment depending on the amount of context switching that must then take place within the application. In many instances, it is not possible to know ahead of time whether such context switching will occur, in order to best determine whether the isSameRM optimization should be employed. As a result, optimizations such as the IsSameRM/join optimization are rarely, if ever used, and indeed in many systems are disabled by default. These are the general areas that embodiments of the invention are intended to address.